/**
 * Created by ymxc003 on 2017/6/30.
 */
const validate = function (name = '正文', min = 100, max = 10000) {
  return (rule, value, callback) => {
    if (value === '') {
      callback(new Error(`${name}不能为空`));
    } else if (value.length < min) {
      callback(new Error(`${name}长度不能小于${min}`));
    } else if (value.length > max) {
      callback(new Error(`${name}长度不能超过${max}`));
    }
    else {
      callback();
    }
  };
};

module.exports = validate
